<template>
	<view>
		<view class="topSe">
			<view class="inputInfo">
				<view class="inputIcon">
					<u-icon name="search" color="#979797" size="32"></u-icon>
				</view>
				<view class="inputHtml">
					<input type="text" v-model="keyword" @confirm="getData" placeholder="请输入您所查询的名称" />
				</view>
			</view>
		</view>
		<view class="goodsList">
			<view class="goods" style="" v-for="(item,index) in goodsListInfo">
				<view class="goodsImage">
					<image :src="bindUrls(item.image)" mode=""></image> 
				</view>
				<view class="goodsTitle">
					<view class="">{{item.cai_name}} </view>
					<view class="goodbtn">
						<view class="goodbtn-view" @click='goUrl("../buKeJianKeHu/buKeJianKeHu?cai_id="+item.id)' >不可见客户</view>
						<view class="goodbtn-view" @click='goUrl("../buKeJianKeHu/buKeJianKeHu?cai_id="+item.id)'>提价</view>
					</view>
				</view>
			</view>			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				goodsListInfo:[],
				keyword:""
			}
		},
		onLoad() {
			this.getData();
		},
		methods: {
			getData(){
				var _this=this;
				var data={
					page:1,
					keyword:this.keyword
				}
				this.$u.api.nmCaiList(data).then(res => {
					_this.goodsListInfo=res;
					//alert(JSON.stringify(res));
				});
			},
			bindUrls(url){// 商品图片单独处理
				var path=this.serviceUrl+url;
				//var path="https://hr.gukecloud.com/"+url;
				//alert("path==="+path)
				return path;
			},
			goUrl(url){
				setTimeout(() => {
					uni.navigateTo({
						url: url
					});
				}, 500)
			}
			
		}
	}
</script>

<style lang="scss" scoped>
	.goodsList {
		display: flex;flex-wrap: wrap;
		.goods {//750-40-40-18  750-98  652/1  325
			width: 326rpx;border-radius: 10px;background: #FFF;min-width: 326rpx;
				margin-left: 20rpx;height: auto;margin-top: 30rpx;
			.goodsImage{margin-left: 23rpx;margin-top: 30rpx;height: 210rpx;width: 280rpx;
				box-shadow: 0rpx -1rpx 5rpx 0rpx rgba(223, 229, 235, 0.41), 4rpx 6rpx 5rpx 0rpx rgba(223, 229, 235, 0.41);
				border-radius: 10px;
				image{
					height: 210rpx;width: 280rpx;border-radius: 10px;
				}
			}
			.goodsTitle{
				text-align: center;margin-top: 18rpx;color: #646464;font-size: 22rpx;
			}
		}
	}
.goodbtn{
	display: flex;
	justify-content: center;
	height: 40rpx;
	align-items: 40rpx;
	margin: 20rpx 0;
	.goodbtn-view{
		border: 2rpx solid #007AFF;
		padding: 0rpx 5rpx;
		//background-color: #007AFF;
		color: #007AFF;
		margin: 0 10rpx;
		
	}
}
	page {
		background-color: #F7F7F7;
		max-width: 750rpx;margin:auto;
	}

	.topSe {
		//background: yellow;
		//background: #FFF;
		height: 100rpx;
		overflow: hidden;
		width: 100%;

		.inputInfo {
			margin-top: 30rpx;
			border-radius: 30px;
			margin-left: 40rpx;
			margin-right: 40rpx;
			height: 70rpx;
			background: #fff;
			display: flex;

			.inputIcon {
				width: 50rpx;margin-left: 193rpx;
				height: 100%; //background: red;

				.u-icon {
					margin-top: 20rpx;
					margin-left: 20rpx;
				}
			}

			.inputHtml {
				flex: 1;

				input {
					//background: green;
					padding-left: 14rpx;
					line-height: 70rpx;
					height: 70rpx;
					width: 100%;
					color: #B9B9B9;
					font-size: 24rpx;
				}

			}
		}

	}
</style>
